package reflection.equals.instof;

import org.junit.Assert;
import org.junit.Test;

public class EqualsTest {

	@Test
	public void testCar()
	{
		Car car = new Car(1L);
		Assert.assertTrue(car.equals(car));
	}
	
	@Test
	public void test2EqualCars()
	{
		Long id = 1L;
		Car car01 = new Car(id);
		Car car02 = new Car(id);
		Assert.assertTrue(car01.equals(car02));
	}
	

	@Test
	public void test2DiffCars()
	{
		Long id01 = 1L;
		Long id02 = 2L;
		Car car01 = new Car(id01);
		Car car02 = new Car(id02);
		Assert.assertFalse(car01.equals(car02));
	}

	@Test
	public void test2DiffObj()
	{
		Car car = new Car(1L);
		Bus bus = new Bus(1L);
		Vehicle vehicle = new Vehicle(1L);

		Assert.assertFalse(car.equals(bus));
		Assert.assertFalse(car.equals(vehicle));
		Assert.assertTrue(vehicle.equals(car));
	}

	@Test
	public void test2AbsolutelyDiffObj()
	{
		Car car = new Car(1L);
		Manager manager = new Manager();
		
		Assert.assertFalse(car.equals(manager));
		
	}
}
